home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / thread.arc / THREAD.DAT < prev    next >
Text File  |  1987-05-09  |  53KB  |  980 lines

  1. #D argc                                             K&R pp. 110-114
  2. #P Commonly used name to represent the count of the number of arguments
  3.    on the command line
  4. #E main(argc, argv)
  5.    int argc;           /* Number of arguments including program name */
  6.    char *argv[];       /* Array of pointers to char to each item entered */
  7.        { if ( argc < 2 )
  8.            { printf("You need at least 2 arguments to use this program\n");
  9.              printf("Example:   sample infil.txt  ");
  10.            } ....
  11. #T argv
  12. #N Invoking a program named "test" with the command line: "test fil1 fil2"
  13.    sets argc to 3.  "Argc" is a descriptive name for argument count, but
  14.    any valid name could be used in its place.  If you don't use the command
  15.    line, there are ways to make your executable code smaller by circumventing
  16.    this setup.
  17. #D strcmp                                                    K & R p. 101
  18. #P Standard library function used to compare strings.  If called with
  19.    character arguments s1 and s2, returns -1 if s1 < s2; 0 if s1 == s2;
  20.    1 if s1 > s2.
  21. #E static char password[10] = "mouse";
  22.    char user[10];
  23.    gets(user);
  24.    if ( strcmp( password, user) == 0 )
  25.       printf("Welcome to the system.........");
  26. #D function                                          KR everywhere
  27. #P Functions are the heart and soul of the C language.  Used to
  28.    modularize routines, and to enable the programmer to reuse code
  29.    as needed.
  30. #E /* Syntax of a function:
  31.    (return type) name_of_function ( argument list, if any )
  32.                  argument declarations, if any;
  33.                    { body of the function }                    */
  34.    /* Examples:   */
  35.    float aver_3(x,y,z)   /* function returns a float value, expects 3 ints */
  36.    int x,y,z;            /* Note how the arguments are OUTSIDE the '{'     */
  37.        { int sum = 0;               /* local variable set to zero          */
  38.          sum = x + y + z;
  39.          return ( sum / 3.0 );      /* return calculated value to caller   */
  40.        }
  41. #D pointers                                          KR Chap. 5 pp 89-117
  42. #P A pointer is a variable which contains the address of another variable.
  43.    Enables the programmer to access information efficiently without
  44.    requiring assembly language routines.
  45. #E int x;
  46.    int *y;            /* y is a pointer that points to an integer  */
  47.    char name[10];
  48.    char *q = name;    /* q is a pointer to character, initially pointing
  49.                          at the address of "name" */
  50.    char *days[] =     { "Mon", "Tues", "Wed" }
  51.                       /* days is an array of pointers to character   */
  52.    struct typ a1;     /* a1 is a structure of type "typ"              */
  53.    struct typ *s1;    /* s1 is a pointer that points to a structure whose
  54.                          size and makeup is like "typ"                */
  55.    int graph();       /* graph is a function returning an int */
  56.    int (*spec)();     /* spec is a pointer to a function      */
  57. #D strlen                                            KR  p. 36,95,98
  58. #P Returns the length of a character string, excluding the closing
  59.    '\0'
  60. #E char name[]    = "hello";
  61.    char first[10] = "Bob";
  62.    char *last     = "pointer";
  63.          printf(" %d  %d  %d", strlen(name), strlen(first), strlen(last)  );
  64.    /* prints:      5  3  7   */
  65. #N The argument to the strlen() function should be a null terminated
  66.    string.
  67. #D malloc                                Not really in KR, but see pp. 96-99
  68. #P Memory allocate function used to set aside blocks of memory at run
  69.    time.  Returns a pointer to the first byte of newly allocated memory
  70. #E  unsigned ptr, no_of_bytes;
  71.     ptr = (int *) malloc ( no_of_bytes );
  72.           /* Note: malloc returns a pointer to char.  To use to point */
  73.           /* to anything else, you should cast the return value to    */
  74.           /* the proper type                                          */
  75. #T ()
  76. #N Malloc does not initialize the allocated bytes.  Its sister function
  77.    calloc allocates memory and sets allocated memory to zero.
  78. #D getc                                                     KR p. 152
  79. #P get the next character from a file.
  80. #E    int c;
  81.       FILE *in;
  82.       /* open a file named on the command line and set file pointer "in" */
  83.       if ( (in = fopen( argv[1], "r" )) != NULL )
  84.          while ( (c = getc(in)) != EOF )   /* get character from that file */
  85.            ....
  86. #T getchar
  87. #N Getchar is often written as a preprocessor macro in which
  88.    the file associated with getc is stdin.
  89. #D calloc                                                       KR p. 157
  90. #P Allocate space to associate with a character pointer, and initialize
  91.    the area to zero.
  92. #E char *calloc();
  93.               /* Takes two arguments, number of bytes and size of object */
  94.    double *xyz;
  95.    xyz = (double *) calloc ( 10, sizeof(double) );
  96.               /* sets aside space for 10 doubles, all set to zero */
  97. #T sizeof
  98. #N The second argument to calloc is very often used with the sizeof operator
  99.    as shown here.  Compare to malloc().
  100. #D strcpy                                                   KR pp. 100-101
  101. #P String copy function, copies the contents of one string to another
  102.    string.
  103. #E static char name[10] = "Whitney";
  104.    char first[20];
  105.    char *s = "alpha";
  106.      strcpy(first, name);  /* Copies contents of name (Whitney) to first */
  107.      strcpy(name, s);      /* Copies string at s (alpha) to name         */
  108. #T strlen
  109. #N strcpy assumes that the destination string is long enough to contain the
  110.    string being copied to it.  No checking is performed.  Standard library
  111.    version of strcpy returns a pointer to char, pointing to the newly copied
  112.    destination.
  113. #D fscanf                                                   KR p. 152
  114. #P File access version of scanf
  115. #T scanf
  116. #E   FILE *data;      /*  if file named DATAIN.TXT is successfully opened  */
  117.      if ( ( data = fopen("DATAIN.TXT", "r")) != NULL )
  118.           fscanf( data, "%4d %4d %s ", &x, &y, str );
  119.                     /* read first values from file associated with file    */
  120.                     /* pointer named "data", using scanf input formatting  */
  121. #D argv                                                     KR pp. 110-114
  122. #P Used as a pointer to an array of pointers, enabling access to command
  123.    line arguments as strings
  124. #E main(argc,argv)
  125.    int argc; char *argv[];     /* Also written:   **argv   */
  126.    { int i = 1;
  127.      while ( argc-- > 0 )   {  printf("\nYou entered: ");
  128.         printf("\n %s = argv[%d] ", argv[i], i++ );
  129.      }
  130.    }
  131. #T argc
  132. #N On UNIX systems, argv[0] is the name of the program.  Most MS-DOS versions
  133.    of C do not support this use of argv[0].
  134. #D union                                                   K&R pp. 138-140
  135. #P enables program to use objects of different types and sizes under
  136.    the same general name
  137. #E union { int   x;
  138.            float y;
  139.          } combo;
  140.    combo.x = 5;
  141.    combo.y = 3.14; /*  Now, int contents of combo are overwritten */
  142. #N The C syntax for declaring unions is similar to that of structures.
  143.    In fact, some compiler error messages generated by faulty union
  144.    usage read as if the error were a struct syntax error.
  145.    The compiler will reserve enough space for the largest type required.
  146.    The responsibility for keeping track of the current contents of the
  147.    union variable is the programmer's.
  148. #D * (indirection)                                      K & R. pp. 89, 187
  149. #T pointers
  150. #P Used to access the contents of an address in memory.  Typically,
  151.    the address is a pointer variable.
  152. #E char *name = "Stella";    /* name is a pointer, initialized to point
  153.                                 at the start of string "Stella"  */
  154.    int *x, y = 5, z; /* x is a pointer to int, y is ordinary int set to 5 */
  155.    x = &y;           /* x is set to address of y; */
  156.    z = *x + 2;   /* z is set to value held at address pointed to by x + 2 */
  157. #N Indirection operator can only be used with variables that are declared
  158.    as type pointer or arrays.
  159. #D = (assignment)                                         K & R p. 41, 191
  160. #P Replaces the object on the left (an lvalue) with the value of
  161.    the expression on the right.
  162. #T ==
  163. #E int x, y, z;
  164.    x = y = z = 5;      /* Sets z to 5, then y to z, then x to y. */
  165.    x = (y + 3) * z;
  166. #N One of the most common errors in C is using an assignment operator where
  167.    a logical comparison is intended.  A statement such as:
  168.           if ( x = 5 )
  169.    means: "set x to 5" and is always TRUE.  This will not generate a
  170.    compiler error since it is valid syntax.
  171. #D #endif                                                  K&R p. 208
  172. #P Preprocessor command which ends a block of source code
  173.    initiated by either an #ifdef or an #else
  174. #E #define DEBUG 1
  175.    #ifdef DEBUG
  176.      printf("\n Debugging print statements ....");
  177.    #endif
  178. #D #include                                               K&R p.86,143,207
  179. #P Preprocessor statement which causes the contents of the named
  180.    file to replace the #include statement
  181. #E #include "stdio.h"     /* Include source lines from file stdio.h     */
  182.    #include "B:MYDEFS.H"  /* Includes file called MYDEFS.H from B drive */
  183.    #include <ctype.h>     /* Include source from ctype.h, which should  */
  184.                           /*   be located in default directory          */
  185. #N Some MS-DOS compilers may not support the notation <file.c>.  Also,
  186.    some compilers may require the '#' to be located in column one.
  187. #D +=  (addition and assignment)                                K&R p.20
  188. #P Adds the value on the right to the current value on the left.
  189. #E sum += x;                      is the same as: sum = sum + x;
  190.    for (i=0; i < 100; i += 10 )   Increments counter variable i by
  191.                                   10 each time through the loop
  192. #N There is no =+ operator... The '=' sign comes last.
  193.    Precedence level 14, only ahead of the comma.
  194. #D escape                                                  K&R p. 181,7,17
  195. #P Representation of special characters that cannot be entered from
  196.    the keyboard or have special meaning within strings
  197. #E     \a    ANSI alarm character        \'   Single quote
  198.        \n    Newline                     \"   Double quote
  199.        \f    Formfeed                    \0   Null
  200.        \b    Backspace                   \xxx Octal value xxx
  201.        \t    Tab                         \v   Vertical tab
  202.        \r    Return
  203.        \\    Backslash
  204. #N You could also use the decimal, octal, or hexadecimal value for
  205.    each of these; that is, Backspace = 8 or 0x8 (hex) or 10 (octal)
  206. #D --  (decrement)                            K&R p. 16,42,102,187
  207. #P Unary operator that decrements its operand by 1
  208. #E int x = 5, b = 7, c;
  209.    x--;              /* x now equals 4 */
  210.    c = --b;          /* Decrement b, then set c equal to b  */
  211.    printf("\n x = %d, b = %d, c = %d", x, b, c );
  212.                      /* prints: x = 4, b = 6, c = 6    */
  213. #N Can be used either as a prefix operator or postfix.  Only applies to
  214.    variables, that is, (x+b)-- is illegal and will cause an error message
  215.    "lvalue required" meaning that (x+b) is not an object in memory
  216. #D >  (greater than)                                       K & R p. 38
  217. #P Greater than logical operator
  218. #E if ( x > 10)
  219.      printf( "\n x is greater than 10");
  220. #N Precedence level 10, just ahead of == and !=
  221. #D & (address operator)                                    K & R p. 89-91
  222. #P Obtain the address in memory where the object is stored
  223. #E int x, *y;           /* x an int, y a pointer to int      */
  224.    scanf("%d", &x);     /* Use address operator with scanf   */
  225.    y = &x;              /* Use in assignment to a pointer    */
  226.    func(&x);            /* Enables func to change value of x */
  227. #N Precedence level 2, along with other unary ops.  The symbol & is
  228.    also used for bitwise AND.  C determines which & through the context
  229.    in which it appears.  Can't use & with expressions, i.e. no &(x+y),
  230.    constants, i.e. no &6, and register variables.
  231. #D & (bitwise AND)                                         K&R pp. 44-45
  232. #P Bitwise AND of operands
  233. #E unsigned int y = 0x4422, z;
  234.    z  = y & 0x00FF;    /* Mask off lower byte  */
  235.                        /* y =0x4422= 0100 0100 0010 0010  in binary */
  236.                        /*    0x00FF= 0000 0000 1111 1111  in binary */
  237.                        /*    bit &   0000 0000 0010 0010  = z       */
  238. #T &&
  239. #N Don't confuse with & used as operator, or && used as logical AND.
  240. #D /=  (division and assignment)                            K&R 46, 191
  241. #P division equals.  Equivalent to: oper_a = oper_a / oper_b
  242. #E int x = 4321;
  243.    int y, i = 0;
  244.       while ( x != 0 ) {
  245.          x /= 10;
  246.          y[i++] = x;   /* y[0] = 432, y[1] = 43, y[2] = 4, y[3] = 0 */
  247.       }
  248. #D .  (member)                                            K&R 120, 196-8
  249. #P member operator for structures and unions
  250. #E struct hello {             /* hello is the struct tag  */
  251.           int id;
  252.           char address[20];
  253.           } helpme;           /* helpme is struct name to use w/ . opr. */
  254.    ...
  255.    printf("\n %d %s", helpme.id, helpme.address );
  256. #D ^  (XOR)                                                 K & R p. 44-45
  257. #P Exclusive OR : Bitwise XOR of values, equals one when one and
  258.    only one of its operands' bits is set to 1.
  259. #E                 8421
  260.    int z;      ------------
  261.    int x = 9;  /*  1001  binary representation */
  262.    int y = 5;  /*  0101                        */
  263.    z = x ^ y;  /*  1100  or 12 in decimal      */
  264. #D scanf                                                    K&R p. 147
  265. #P Reads from the standard input, providing formatted input according
  266.    to its control string.
  267. #E int x, y[5];
  268.    static char str[10] = "hello";
  269.    char c;
  270.    scanf(" %d %d ", &x, &y[0] );    /* Note the (&) address operators */
  271.    scanf(" %s %c ", str, &c   );    /* No (&) for char strings        */
  272. #N scanf control string is similar that of printf.  Scanf is a function and
  273.    should return the number of items successfully matched to the control
  274.    string.  Scanf will return EOF if it attempts to read through it.
  275.    Try to use gets() instead of scanf() wherever possible, as input
  276.    to scanf which doesn't match the control string will cause havoc.
  277. #T printf
  278. #D atoi                                                   K & R p.39, 58
  279. #P Convert character strings to integer (ascii to integer)
  280. #E char user[10];
  281.    int x;
  282.    gets(user);
  283.    x = atoi(user);
  284. #N atoi takes character strings as arguments, not single characters.
  285.    This is a standard library function.
  286. #D ()     (Cast operator)                                  K&R p. 48
  287. #P Changes the internal representation of the data object's type for
  288.    use in an expression
  289. #E int i = 1, *p;            /* p is a pointer to int */
  290.    double z;
  291.    char *malloc();           /* Malloc returns a pointer to char */
  292.    p = (int *) malloc(100);  /* So 'cast' malloc return to type int */
  293.    ....
  294.    z = (double) i / 2 ;      /* Coerces i to double, sets z to .5   */
  295. #N Parens are also used to override the order of operations in expressions.
  296. #D []  (array element)                           K&R p. 49, 93, 103-110
  297. #P Array element specifier
  298. #E int a[10];         /* Defines an array of size 10 with individual  */
  299.                       /* elements a[0], a[1], ...., a[9]              */
  300.    float taxes[2][4] = {  { .10,  .15,  .20, .25 },  /* Multi-dimension */
  301.                           { .08,  .13,  .18, .23 }  };
  302.                       /* An array of pointers */
  303.    char *days[7] = { "Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat" };
  304. #N C provides a rich variety of arrays.  They can also be used with
  305.    structures and unions.  Even arrays of pointers to functions may
  306.    be created.  In the taxes example above, one dimension could be left
  307.    out of the declaration: float taxes[][4] = ... would also work.
  308. #D !  (logical not)                                        K&R p. 38
  309. #P "Not" operator.  Negates the truth value of its operand.  An operand
  310.    is "true" if it is not equal to zero.
  311. #E if ( ! inword )
  312.        count_word();
  313. #T !=
  314. #N While the "not" operator can be handy in some situations, it can
  315.    create some very confusing logic in others.
  316. #D %  (modulus)                                        K&R p. 37, 188
  317. #P Modulus operator - takes remainder of integer division
  318. #E int a = 7, b = 3, c;
  319.    c = a % b;           /* c equals 1, remainder of 7/3 */
  320. #N Can only be used on integers.  Not defined for floats.
  321. #D |  (bitwise OR)                                    K&R p.44,190
  322. #P Bit level OR operation.
  323. #E int x, mask = 1 ;
  324.    x = x | mask;         /* Turns the rightmost bit of x on */
  325.                          /* without affecting any other bits */
  326. #N Used to turn bits on.  Precedence level 6 of 15.  Do not confuse this
  327.    with the || logical connective.
  328. #D -= (subtract and assign)                                      K&R p.20
  329. #P Subtracts the value on the right from the current value on the left, and
  330.    stores the result as the name on the left.
  331. #E balance -= check;    /* is the same as: balance = balance - check; */
  332.    for (i=100; i > 0; i -= 10 )   Decrements counter variable i by
  333.                                   10 each time through the loop
  334. #N There is no =- operator... The '=' sign comes last.
  335.    Precedence level 14, only ahead of comma.
  336. #D *=  (Multiply and assign)                                    K&R p.20
  337. #P Multiplies the value on the right by the value on the left, and stores
  338.    the result as the variable name on the left.
  339. #E product *= i;            /*   is the same as: product = product * i; */
  340. #N There is no =* operator... The '=' sign comes last.
  341.    Precedence level 14, only ahead of comma.  Don't confuse with
  342.    pointer expressions.
  343. #D ?: (Conditional operator)                           K&R p. 47-48, 191
  344. #P An if-then-else or conditional operator
  345. #E    int maxx,x,y;
  346.       maxx = ( x > y) ? x : y ;  /* If x is greater than y, set maxx =x */
  347. #N C's unique ternary operator is very powerful.  The advantage over setting
  348.    up an if (  ) statement is SPEED.  Very often used in preprocessor
  349.    macros.
  350. #D ==   (test for equality)                             K&R p. 38,190
  351. #P Tests for equality of two expressions
  352. #E if ( x == y)
  353.       printf("\n x and y are equal");
  354.    if ( (c=getchar()) == EOF)   /* parens supercede =='s higher precedence */
  355.       exit();                   /* than the assignment =   */
  356. #N The test for equality is not the same as assignment operator!  One of
  357.    the most common mistakes in c is to write an if statement such as:
  358.    if ( x = 4 )  -- which means "set x equal to 4" and is always evaluated
  359.    as "true"!
  360. #D double                                                   K&R p. 2
  361. #P Defines data attribute as double precision floating point
  362. #E double x,y;                    Declares variables x and y as double
  363.    double z = 3.141;              Declares variable z and initializes it
  364.    y = (func((double)i);          Used as a cast operator to coerce attribute
  365.                                      of i to double precision.
  366.    printf(" %f", x);              Prints double variables using float
  367.                                   format; there is no % format item for
  368.                                   double itself.
  369. #N All floating point arithmetic in C is done in double precision.
  370.    Some small versions of C compilers will not support double as an
  371.    attribute of variables. Size of storage used for double variables
  372.    varies with hardware.  Scanf() escape sequence for input of doubles
  373.    can be unorthodox: some use %lf, some %D.
  374. #D sqr                                                Not in KR
  375. #P sqr(value) obtains the square of the value.
  376. #E y = sqr(x):                     if x is 3, y will be assigned 9
  377.    y = sqr(x+1):                   if x is 3, y will be assigned 16
  378. #N This is not a C keyword, but is frequently provided in the standard
  379.    library.  It can be easily implemented as either a function or as
  380.    a preprocessor macro, as in:
  381.                #define sqr(x) (x)*(x)
  382.    If defined as a macro without ()'s around argument, can cause problems.
  383.    For example,  #define sqr(x)  x * x
  384.    returns 11 if x = 5 and the source code uses sqr(x+1)
  385. #D char                                                       K&R p. 9
  386. #P Used when 'declaring' a variable of character type.  It is referred
  387.    to as a type-specifier.
  388. #E char alpha;               /* alpha is a variable of char type     */
  389.    char BEEP     = '\007';   /* initialized to octal value 007       */
  390.    char TAB      = '\t' ;
  391.    char *item    = "pointer version";
  392.    char name[6]  = "Lynda";  /* an array of chars, with space for the
  393.                                ending '\0' (NULL)  */
  394.    char name[]   = "enough space automatically";
  395. #N When initialized, character values can be expressed in three
  396.    ways: using character constants, special escape sequences, or
  397.    using an ASCII code expressed in octal notation.
  398.    Chars on most compilers are unsigned.  This can create problems if
  399.    you attempt to compare a char against EOF (-1).
  400. #D do                                                        K&R p. 59
  401. #P Part of a do ... while program control statement.  Used
  402.    when the body of a loop must be executed at least once.
  403. #E do
  404.       printf( "\n %d", i++) ;
  405.    while ( i < 10);
  406. #N The body of the statement appears between the do and the while,
  407.    and may be a compound or simple statement.  The condition which
  408.    is tested appears at the end of the control structure.
  409. #D &&  (Logical AND )                                         K&R p.38
  410. #P Creates a logical expression which is true only when the expressions
  411.    on both sides of the operator are true.
  412. #E if (j > 0 && j <100)   /* for the expression to be true, j must be */
  413.                           /* both greater than 0 AND less than 100 */
  414. #N Expressions using && are evaluated left to right, and if the lefthand
  415.    side of the expression is false (a zero value), than the righthand
  416.    side of the expression is not evaluated at all.
  417. #D getchar                                                 K&R p.13
  418. #P Reads a single character from the standard input device
  419.    (normally the keyboard).  No arguments appear within the parentheses.
  420. #E c = getchar();  /* where c is a variable of type int */
  421.    while ( (c=getchar()) != EOF )  /* get the character, assign it to c,
  422.                                       then check c against EOF    */
  423. #N This is a standard function available as part of the input/output
  424.    library provided with any C compiler. Getchar() may be implemented as a
  425.    macro or a function. Getchar is often used with redirection of input
  426.    and output.  Getchar returns a value of (-1) on many compilers when
  427.    it reaches the end of a file.  To allow the receiving variable to
  428.    hold -1, the data type is usually declared as int rather than char.
  429. #D struct                                                     K&R p.119-142
  430. #P Used to show a relationship between groups of variables.
  431.    Used to form a skeleton or template housing a set of logically related
  432.    variables which can then be referenced as part of that set.
  433. #E      struct facts {                      /* facts is the "tag" name  */
  434.                       char last_name[20];
  435.                       char ssn[12];
  436.                       int age;
  437.                       } employee;  /* employee is a struct of type facts */
  438.         employee.age = 34;
  439. #N There are several ways to define and reference structures. In particular,
  440.    pointers to structures may access elements via the notation ->.
  441. #T .
  442. #D for                                                        K&R p. 11,56
  443. #P Used to execute statements more than once.
  444.    The reserved word "for" creates a loop which allows a set of instructions
  445.    to be executed until a certain condition is met.
  446. #E      int q;
  447.         for (q=1; q <= 100; ++q)
  448.             printf("TESTING");
  449. #N The example above will print the string TESTING 100 times.
  450.    The for loop will not execute if the second condition is already true.
  451.    Two  semicolons are required between the parens.  THERE IS NO ; AFTER
  452.    THE CLOSING RIGHT PAREN!!!
  453. #D >>  (SHIFT RIGHT OPERATOR)                                     K&R p.45
  454. #P Used to move bits to the right in a variable.
  455.    The operator ">>" can be used for multiplication and division of integers.
  456.    The operator is more often used in decoding input from external devices.
  457. #E                  VARIABLE        BINARY         VALUE
  458.                     --------        ------         -----
  459.                      x = 5;        00000101          5
  460.                      x >> 1;       00000010          2
  461. #T >>=
  462. #N When bits are shifted off one end; they are lost and are replaced by
  463.    zeros on the other end.
  464. #D printf                                                       K&R p.10-11
  465. #P Standard library function for formated print to standard output.
  466.    Allows for the a variety of formats such as decimal, floating point,
  467.    hexadecimal, characters, strings, etc.
  468. #E printf("\n The value of x is %d", x);
  469.    printf("\n Minimum of four places, right adjusted is %4d", x);
  470.    printf("\n PI = %f", PI);
  471.    printf("\n Hexidecimal = %x, Octal = %o, Int = %d", x, x, x );
  472.    printf("\n %s", string );
  473. #N Printf determines the number of arguments it receives through the
  474.    number of escape arguments (%d, %s, etc) it receives.
  475.    The next screen contains more detail on printf.
  476. #D printf  (continued)                                         K&R p. 10
  477. #P Sample printf format items
  478. #E int x = 300; float pi = 3.14; static char str[] = "alphabet";
  479.     Statement                    |     Prints
  480.    printf("\n|%d|", x);          |     |300|
  481.    printf("\n|%2d|",x);          |     |300|
  482.    printf("\n|%6d|",x);          |     |   300|
  483.    printf("\n|%-6d|",x);         |     |300   |
  484.    printf("\n|%f|", pi);         |     |3.140000|
  485.    printf("\n|%3.1f|",pi);       |     |3.1|
  486.    printf("\n|%8.3f|",pi);       |     |   3.140|
  487.    printf("\n|%s|", str);        |     |alphabet|
  488.    printf("\n|%4s|",str);        |     |alphabet|
  489.    printf("\n|%4.2s|",str);      |     |  al|
  490.    printf("\n|%-20s|",str);      |     |alphabet           |
  491. #D int                                                          K&R p. 9
  492. #P Declares a variable to be of type integer.
  493. #E int number;                      /* integer with no initialized value */
  494.    long int million    = 1000000;
  495.    short int sh_num    = 077;       /* short octal                       */
  496.    unsigned int hexnum = 0xF;       /* unsigned hexadecimal              */
  497.    printf(" %d", number);
  498. #N The range of numbers allowed by int will vary from machine to machine.
  499.    Check the specifications of your compiler.  Commas are not to be used when
  500.    defining constants.  Neither decimal points nor exponent notation can be
  501.    used when defining int constants.
  502. #T unsigned
  503. #D return                                                     K&R p. 23
  504. #P Used to terminate the execution of the current function. Returns control
  505.    to the calling function, and sends a value back if one is needed.
  506. #E return;              /* Returns control without a value.          */
  507.    return x ;           /* Returns control with value named "x"      */
  508.    return (x);          /* Returns the value "x"                     */
  509.    return (x+y);        /* returns the sum of x and y                */
  510.    return ():           /* ERROR -- Not a valid statement            */
  511. #N The return type is set when the function is defined.  "void" is
  512.    recommended when no value is to be returned.
  513. #D <   (less than)                                            K&R p. 38
  514. #P Relational test for "less than."
  515. #E if (a < b)
  516.         printf("a is less than b");
  517.    else printf("a is not less than b");
  518. #N Associativity (evaluation) is left to right.
  519. #D fgetc                                                         K&R p. 152
  520. #T getchar
  521. #P Does a single "file GET Character" from the file indicated by the file
  522.    pointer within the parentheses.
  523. #E int c;
  524.    FILE *in;
  525.    in = fopen("INFILE.DAT","r");
  526.    c = fgetc(in);     /* Gets a character from file named INFILE.DAT
  527.                          pointed at by "in". */
  528. #N fgetc is a genuine function and so is more predictable in results than getc
  529.    on many C compilers.  A valid fopen statement must return the file pointer
  530.    used within the parentheses of the fgetc function.
  531. #D - (unary minus)                                          K&R p. 187
  532. #P Changes sign of an operand.
  533. #E -(expression)
  534. #N -x;           Changes the sign of the variable x.
  535.    -(x+y)       The operand or expression upon which the unary minus
  536.                 operates does not have to be an lvalue.
  537.    Old versions of C had no unary '+', but newer versions will have one.
  538. #D -> (pointer structure member)                                K&R p. 122
  539. #P Accesses members of a structure (or group of
  540.    related variables) that are indicated by a pointer.
  541. #E resp = ptr->age;  /* resp takes the value of the "age" filed within
  542.                         the structure pointed to by "ptr" */
  543. #N p -> month   If p is a pointer to the first address of a
  544.                 structure, and month is one of the elements
  545.                 of the structure, then it is obtained by
  546.                 p -> month.
  547.    The -> has the highest precedence of any C operator.
  548. #D <= (less than or equal to)                                  K&R p. 189
  549. #P Logical test of whether the first operand is less than or equal
  550.    to the second operand.
  551. #E if ( x <= y)
  552.       printf("\n x is less than or equal to y");
  553. #N Fortran programmers might emulate their roots with something like
  554.              #define LE <=
  555. #D >= (greater than or equal to)                               K&R p. 189
  556. #P Logical test of whether the first operand is greater than
  557.    or equal to the second operand.
  558. #E if ( x >= y)
  559.       printf(" x is greater than or equal to y");
  560. #D isalpha                                                     K&R p. 156
  561. #P A preprocessor macro that tests if a character is alphabetic.
  562. #E if ( isalpha(char_var) )
  563.       puts( "char_var is alphabetic");
  564. #N isalpha(c) The macro evaluates to 1 if the character is alphabetic and
  565.    0 if it is not.
  566. #D continue                                                     K&R p. 62
  567. #P Control of a loop sequence.  Cause program flow to skip to the
  568.    next iteration of the loop.
  569. #E for ( i = 0; string[i] != '\0'; i++ ) {
  570.        if (string[i] == '-' ) continue;   /* Don't process if it's a '-' */
  571.        else process(string[i]);
  572.    }
  573. #N Try to avoid the continue statement wherever possible, as it's use may
  574.    encourage broken and confusing logic.
  575. #D #undef                                                      K&R p. 207
  576. #P Preprocessor command which causes the compiler to remove, or
  577.    "forget" subsequent uses of the identifier.  Opposite of #define
  578. #E #if defined(VALUE)       /* Checks to see if VALUE is already   */
  579.    #undef VALUE             /* defined. Undefines it if necessary, */
  580.    #endif                   /* then replaces new VALUE with 100    */
  581.    #define VALUE 100
  582. #D %=  (mod assignment)                                       K&R p. 191
  583. #P Perform modulus operation and assignment
  584. #E int x = 7, y = 3;
  585.    x %= y;     /* Equivalent to x = x % y;                            */
  586.                /* 7 % 3 is 1, the remainder of the integer division   */
  587.    printf("\n x is equal to %d", x);   /* prints:  x is equal to 1    */
  588. #N Performs the modulus operation, then assigns the results of that operation
  589.    to the value on the left.   Only works on integers.
  590. #D float                                                           K&R 9
  591. #P To declare a variable as a floating-point decimal value
  592.    to allow a variable to be used in floating-point arithmetic;
  593. #E float tempf, tempc; /* converts Celsius to Fahrenheit */
  594.    tempf = 1.8 * tempc + 32.0;
  595. #N For greater precision, you may use type "double".  Pre-ANSI C performed
  596.    all arithmetic in double even if variables were declared float.
  597. #D -  (subtraction operator)                                    K&R p. 37
  598. #P  Subtracts one operand from another
  599. #E  int x = 5, y = 3, z;
  600.     z = x - y;
  601. #N Just as in most other computer languages.
  602. #D !=  (Not equal to)                                 K&R p. 38, 190
  603. #P to test for inequality in logic statements
  604. #E while ( (c=getchar() ) != EOF)
  605.        /*   Gets characters from standard input file into c
  606.             as long as getchar() does not return EOF         */
  607. #N Associativity is left to right.
  608. #D pow                                                         K&R p. 23
  609. #P to raise a number to a specified power
  610. #E double x = 2.0, n= 3.0 ;
  611.    z = pow(x,n) /* raises x to the power n:  */
  612.                 /* z = 8.0                   */
  613. #N Domain errors abound here.  Check your compiler's documentation.
  614. #D #ifdef                                                    K&R   p. 208
  615. #P A preprocessor command which tests for a definition of a preprocessor
  616.    value
  617. #E #ifdef DEBUG                               /* if there was a statement */
  618.    printf("Value of x in line 200 = %d", x);  /* #define DEBUG, the print */
  619.    printf("Value of y in line 201 = %d", y);  /* lines will be included   */
  620.    #endif
  621. #D while                                                    K&R 3,9,56,202
  622. #P Evaluates a loop control expression, and, if true, executes the
  623.    desired loop body statement. It repeatedly evaluates, then executes, until
  624.    the control expression is false.
  625. #E int c, i = 0;
  626.    while ((c=getchar()) != EOF)
  627.          putchar(c);             /* Copies an entire input stream  */
  628.    while ( ++i < 4 )
  629.          printf("%2d", i);       /* Writes: 1 2 3                  */
  630. #N If the loop is more than one statement, enclose it in '{ }'.
  631.    There is no semi-colon following the closing parenthesis of the control
  632.    expression unless the loop body statement is a null one.
  633. #D default                                                  K&R p. 55, 203
  634. #P The optional case of a SWITCH control statement.  The default case is
  635.    executed when the other specified cases are not satisfied by the control
  636.    statement of a SWITCH.
  637. #E switch (x) {
  638.       case 4  :  special();   break;
  639.       default :  normal();    break;
  640.    }
  641. #N default is optional.  It need not appear as the last case of a switch
  642.    statement.  There can be only one default in a switch.
  643.    See also: switch
  644. #D register  (class of storage)                           K & R 81, 192
  645. #P provides rapid access to high-usage int and char variables
  646. #E               register  int i;
  647.                  for (i=0; i < 10001; i++)
  648.                  ;   /* A high speed loop because i is register */
  649. #N Often used with int variables or text pointers when
  650.    they are accessed frequently as subscripts.  Some compilers claim to
  651.    support register variables, but in fact, only implement them as ints.
  652.    In addition, there may be compiler restrictions on the number of "true"
  653.    register vars available.
  654. #D >>=  (logical right shift and assign)                   K&R p. 38, 189
  655. #P Shifts bits to the right and assign a value
  656. #E int j =8;
  657.    j >>= 1;    /* Shifts the bits of j to the right one position          */
  658.           /*     0000 1000     Binary representation of j before          */
  659.           /*  -> 0000 0100     Binary after, effectively dividing by two  */
  660. #N High order position(s) are zero filled.  Handy for moving values between
  661.    internal registers like AH, AL.
  662. #D <<  (logical left shift)                                K & R p.44,189
  663. #P Used to shift bits to the left, similar to ASM instruction SHL
  664. #E int j = 4; j = j << 1;    /* shift all bits left one place --   */
  665.                              /*  same as multiply j by  2          */
  666. #N Fills on the right with zero.  Use with char and int variables only.
  667. #D auto                                                     K&R 23,28,72
  668. #T static
  669. #P Declares a variable type auto, which stands for automatic.
  670.    All variables declared auto are "local" to a function.
  671. #E auto int answer;
  672. #N Benefit: same variable name can be utilized in other functions
  673.    without conflict. The default type of all variables is auto.
  674. #D ++  (increment)                                      K&R 16,42,102,187
  675. #P Increment operator - adds one to its operand
  676. #E int a = 6;
  677.    int b = 0;
  678.    b++;      /* b nows equals 1 */
  679.    b = ++a;  /* Increment a to 7, then set b equal to 7 */
  680. #N The ++ operator can be written before the variable which is called
  681.    prefix notation or after which is called postfix notation.  Can be used
  682.    only on variables; that is (a+b)++ is illegal.
  683.    In the expression:  for ( x=0; x< 10; x++)  using x++ or ++x is a
  684.    matter of taste.
  685. #D ,  (Comma)                                               K&R p. 58,192
  686. #P The comma operator is used to specify left to evaluation of
  687.    expressions in a statement.
  688. #E int x, y = 2;                   /* Only y is initialized       */
  689.    int gap, i, j, temp;
  690.    for (i=0, j=0; i < 10; i++, j += 2)
  691.        foo(i,j);
  692. #N The comma has the lowest precedence of all C operators and most
  693.    often finds use in declarations and for statements.
  694. #D abs                                                     K&R
  695. #P Takes the absolute value of its argument
  696. #U As an absolute value, this can be used in a macro or preprocessor
  697.    statement to reverse a negative value to a positive value.
  698. #E int result, number;
  699.    number = abs(result);
  700. #N This is not a standard C function but can be easily implemented as either
  701.    a function or a preprocessor macro.
  702. #D short                                                   K&R p.9,34
  703. #P an integer type variable, used for relatively small integers
  704. #E short int i;
  705.    short i;
  706. #N the capacity of short is machine dependent and can be determined
  707.    by use of the sizeof operator:  printf("%d", sizeof(short) );
  708. #D ||  (OR)                                                     K&R 19, 191
  709. #T |
  710. #P the symbol for the logical OR operator
  711. #E if (day == 6 || day == 7)
  712.       printf ("\nWeekend!");
  713.    if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
  714.       printf("\n %c is a vowel", c);
  715. #N Curiously, the || operator has lower precedence than the logical
  716.    AND operator (&&).
  717. #D putchar                                                  K&R p. 13,144
  718. #P Puts a single character out to the standard output.
  719. #E putchar(c);
  720. #N the function can be used to write an escape character, the
  721.    contents of a variable, or a character to the standard output file
  722. #D entry                                                    K&R p. 180
  723. #P A reserved keyword that was never implemented on any C compiler.
  724. #N ANSI standard has dropped entry as a C keyword.
  725. #D switch                                                   K&R p. 55
  726. #P Selects from multiple alternatives
  727. #E switch  ( number )  {       The switch evaluates the integer expression
  728.      case 1  : func1();        in parentheses and compares its value to all
  729.                break;          the cases. Each case must be labeled by an
  730.      case 2  : func2();        integer or a character expression. If a case
  731.                break;          matches the expression value, execution starts
  732.      default : puts("Other");  at that case. If none of the cases matches,
  733.      }                         then the default is executed if it is there,
  734.                                or no action takes place.
  735. #N Cases must be different.  The cases must evaluate to constants.
  736. #T case
  737. #D *  (multiply)                                            K&R p.37
  738. #P Multiplication operator
  739. #E atimesb = a * b;
  740.    xtimes3 = x * 3;
  741. #N * has a precedence lower than the unary operators (-,++,--) but
  742.    higher than the addition and the subtraction operators (+,-).
  743. #D exp                                        Omitted K & R, but see p. 20
  744. #P exponential function returning the power of e
  745. #E double x,exp(),exp_of_e;
  746.    exp_of_e = exp(x);      exp() returns the value of e raised to xth power
  747. #N Function exp() and its argument x must be both declared double.
  748.    exp() is not a standard C function and may not be present for some
  749.    compiler libraries.
  750. #D &=  (bitwise and with assignment)                       K&R p. 191
  751. #P The "&" is a bitwise "and" operator, combined with assignment.
  752. #E int x   =  7;        /* In binary x =  000111     */
  753.    int res = 18;        /*         res =  010010     */
  754.    res  &=  x;          /* AND (&) yields 010111   = 23 in decimal */
  755.                         /* then assign that value to res          */
  756. #N Very low precedence, level 2 of 15.  See the & operator for more
  757.    detail on binary AND.
  758. #D fopen                                              K&R p. 151,167
  759. #P The "fopen" is used to open a file (disk file, printer file, etc.)
  760.    for three possible operations : reading, writing, or appending.
  761. #E FILE *infile, *outfile, *logfile; /* File pointers         */
  762.    infile  = fopen("data.inp", "r"); /* File data.inp opened for read,   */
  763.    outfile = fopen("data.out", "w"); /* data.out opened for writing, and */
  764.    logfile = fopen("data.log", "a"); /* data.log opened for appedning    */
  765.    /* fopen returns NULL if it can't open the file as requested  */
  766.    /* The return value of fopen should always be checked!        */
  767. #N The data type returned by the call to the "fopen" function,
  768.    depends upon the operating system being used. The datatype of
  769.    FILE is usually presented in the stdio.h header.  Some compilers permit
  770.    open modes "r+", "w+", and "a+" which allow both reads and writes.
  771. #D unsigned                                                K&R p.34,45,183
  772. #P Declares an integer type variable that will not take on negative values
  773. #E unsigned int month;
  774.    unsigned address;
  775.    printf( " %u", address);
  776. #N Unsigned integers on a 16-bit machine typically take on values from
  777.    0 to 65,535.  The compiler uses the sign bit of the variable to store values
  778.    rather than the negative sign.  Some compilers will also support the
  779.    declaration unsigned char or unsigned long.  The new ANSI standard
  780.    specifies that unsigned may be used with chars.
  781. #D long                                                     K&R p.35,180
  782. #P Declares an integer type variable as long, which allows variable more
  783.    than the usual (typically twice) amount of storage space
  784. #E long deficit;
  785.    long int address = 130000L;
  786.    printf("\nThe deficit is %ld", deficit);
  787. #N A constant long value can be created be adding the letter "L" to the
  788.    end of an integer constant.  Be careful adding regular integers to long
  789.    integers -- some compilers have trouble.
  790. #D typedef                                            K&R p.140,173,192,200
  791. #P Allows you to create your own names for new data types, or storage classes
  792. #E typedef int COUNTERS;
  793.    typedef struct { int month;           /* Creates a structure with */
  794.                     int day;             /*  three members           */
  795.                     int year; } DATE;
  796.    DATE anniversary, birthday;
  797.    COUNTERS i,j,k;
  798. #N typedef is a portability aide.  By using it, you create your own
  799.    names for data types, and then make changes to the data type definitions
  800.    rather than throughout the program.  Also, the use of typedef can make
  801.    the uses of the variables more obvious.  In the above example, integers
  802.    i,j and k are clearly labeled as COUNTERS.
  803. #D enum                                          Not mentioned in K&R
  804. #P Declares a variable to be of type enumerated data
  805. #E enum val { true, false};
  806.    enum direct {east, west, north, south};
  807. #N The only values which can be assigned to the data type are given in
  808.    the accompanying list upon declaration.  This feature is not mentioned
  809.    in Kernighan and Ritchie and not supported by many compilers.
  810.    It is part of the new ANSI X3J11 C standard.
  811. #D extern                                                   K&R p. 30
  812. #P Used to define the storage class of the object as external.
  813.    External variables may be defined later on in the source file, or in
  814.    another file altogether.
  815. #E void func()
  816.      { extern x; ---
  817.        auto y;      |
  818.        ....         |____\  Same x referred to.
  819.      }              |    /
  820.    int x;  ---------
  821. #N Extern variables are global in scope.  It's common practice to place
  822.    all the external variable at the beginning of the source file, outside
  823.    the declaration of any function or main.  This practice makes them
  824.    external by default, and the extern declaration within the function is
  825.    commonly omitted. It's better to always explicitly declare them.
  826. #D static                                                 K&R p. 28,80,192
  827. #P Used to define the storage class of the object as static.  Static
  828.    variables retain their values when a function is completed.
  829. #E static int x;
  830.    extern static y;
  831.    static char msg[] = "This will provide 28 spaces"; /* 27 chars + NULL */
  832.                     /* To initialize a string within a function this way,
  833.                        you must use static */
  834. #N Unlike other C variables, static variables, if they are not initialized,
  835.    are set to zero. All static variables have memory allocated to them as
  836.    long as the program is runnning.  Static variables are initialized once
  837.    and only once.  In a multi-file context, static makes objects "private"
  838.    to that file, in the sense that static names are not "known" to
  839.    other files.
  840. #D if                                                K&R p. 17, 51-53, 201
  841. #T else
  842. #P Used to test a condition, and then execute a statement or block of
  843.    statements depending on the outcome of the test.
  844. #E if ( a > 10 )
  845.         printf("\n a is greater than 10");
  846.    if ( b > 10 ) {                         /* Enclose multiple statements */
  847.         printf("\n b is greater than 10"); /* in braces                   */
  848.         printf("\n Line #2 ");
  849.    }
  850. #N It's a good idea to indent statements after an if statement to better
  851.    display the underlying logic.  C does not use the keyword "then".
  852. #D else                                                     K&R p. 21,53
  853. #P An optional part of an if statement used to execute a statement or
  854.    block of statements if a condition is not true.
  855. #E if (x > 10)
  856.        funct1();
  857.    else          /* Use { } if more than one statement in body of loop */
  858.        funct2();
  859. #N Else may be nested with its own if, as in:
  860.      if (a<10)  do_b();
  861.        else if (a< 5) do_c();  In which case, the else applies to the
  862.    most previous 'if' without an else.  You can use {} to change this
  863.    if necessary.
  864. #D goto                                                     K&R  p. 62
  865. #P To create hopelessly tangled program logic.
  866. #E if ( (in = fopen("data.fil", "r") == NULL)
  867.       goto finish;
  868.    .....
  869.    .....
  870.    finish : exit();
  871. #N Kernighan and Ritchie describe goto's as "infinitely-abusable" and
  872.    "never necessary".  If you insist on using the goto statement, maybe
  873.    you should avoid the C language.
  874. #D case                                                     K&R   55,202
  875. #T default
  876. #P Used as part of the "switch" control statement, case itemizes the
  877.    constant expressions which, if true, will cause execution of a
  878.    section of code.
  879. #E switch (val) {
  880.        case 1  : printf("val is equal to 1");  break;
  881.        case 2  : yourfunc();                   break;
  882.        default : printf("\n I'm confused if other than 1 or 2");
  883.                  break;
  884.        }
  885. #N The value following the case statment must be either an integer
  886.    or a char constant.  (That is, it can be:  case 'a' :   etc.)
  887.    The case statement continues until it hits a "break"; if none
  888.    exists, it "flows" into the next condition.
  889.    Cases need be in no particular order.
  890. #D break                                                  K&R p. 56,61,203
  891. #P Used to cause immediate exit from a for, while, do, or switch
  892.    statement.
  893. #E switch (val) {
  894.         case 1  : printf("\n Value is 1");    break;
  895.         case 2  : printf("\n Value is 2");    break;
  896.         default : break;
  897.         }
  898. #N Use of the break statement should be avoided where possible in
  899.    all constructs except the switch statement.  Control passes to the
  900.    statement following the while, do, for or switch statement.
  901. #D ~  (Complement)                                       K & R 45, 187
  902. #P One's complement bit operator
  903.    Toggles all the bits of a data item to the opposite value
  904. #E unsigned int x = 7;           /* Binary = 0000 0000 0000 0111   */
  905.       ~x;              /* Would be: 65528  = 1111 1111 1111 1000   */
  906. #N A unary operator.  Requires an integer type operand.
  907. #D void                                                  Not mentioned K&R
  908. #T return
  909. #P Used to declare that a function does not return a value.
  910. #E void yourfunc(a1,a2)
  911.    int a1, a2;
  912.       {
  913.        printf("\n The value of a1 is %d, and a2 is %d ", a1, a2);
  914.       }
  915. #N The new ANSI standard C requires that all functions which do not return
  916.    a value have a void type. If your compiler doesn't recognize the word, you
  917.    can use the preprocessor statement:
  918.              #define void int
  919. #D sizeof                                                K&R p. 126,187
  920. #P Used to obtain the memory size of the operand item in bytes.
  921. #E struct date { int month;
  922.                  int day;
  923.                  int year;
  924.                };
  925.    int s;
  926.    s = sizeof(struct date);
  927.    printf("The size of a double on your machine is %d", sizeof(double) );
  928. #N This is formally a C operator, not a function and has a precedence level.
  929.    The size of an object in bytes is useful knowledge when trying to
  930.    port code to another machine or environment.  You can also obtain the
  931.    sizeof an array or structure.
  932. #D #define                                               K & R p. 86-87
  933. #P Preprocessor definition of a value or macro
  934. #E #define PI 3.1428
  935.    #define max(x,y) (x > y) ? (x) : (y)
  936.     /* Note:  ^-- No space allowed between the name of the macro
  937.                   and the parameters used.  That is, #define mac (c) ...
  938.                   will substitute (c)... for mac wherever it appears   */
  939. #N Do NOT use a ';' after define statements.  Convention is to use capital
  940.    letters for defined constant values.  Some compilers permit you to extend
  941.    a #define statement by  using a '\' as the "continuation" character.
  942.    A #define statement may use other values that have been previously
  943.    defined in other #define statements.
  944. #D +  (add)                                              K&R p. 37, 188
  945. #P Adds two operands
  946. #T ++
  947. #E int a = 10, b = 20, c;
  948.    double x = 32.4, y = 98.7 ;
  949.    c = a + b;
  950.    printf("\n c equals %d, and x + y = %lf",  c, x + y);
  951. #N Standard operation as in most other languages.  Don't confuse with ++.
  952. #D /  (divide)                                           K&R  p. 37, 188
  953. #P Divides two operands
  954. #E int x = 30, y =5, q;
  955.    double a = 36, z = 18, d;
  956.    q = x/y;
  957.    d = z/a;
  958.    printf("\n x/y = %d, z/a = %lf", q, d );
  959. #N Integer division yields no decimal portion.
  960. #D precedence                                            K & R p. 49
  961. #P Rules of precedence for C operators define the order of evaluation
  962.    in the absence of parentheses.
  963.                    Operator                       Associativity
  964.              1     () [] ->  .                    left to right
  965.              2     ! ~ ++ -- - (type) * & sizeof  right to left
  966.              3     *  /  %                        left to right
  967.              4     +  -                           left to right
  968.              5     << >>                          left to right
  969.              6     < <= > >=                      left to right
  970.              7     ==  !=                         left to right
  971.              8     &                              left to right
  972.              9     ^                              left to right
  973.             10     |                              left to right
  974.             11     &&                             left to right
  975.             12     ||                             left to right
  976.             13     ?:                             right to left
  977.             14     =  +=  -=  etc.                right to left
  978.             15     ,                              left to right
  979. #D
  980.